package exam1;

public class FactoryMethod {
    public static void main(String[] args) {
        Computer c = null;
        Factory f = null;
        f = new DellFactory();
        c = f.getComputerType();
        c.ComputerType();
        f = new LenovoFactory();
        c = f.getComputerType();
        c.ComputerType();
        f = new AcerFactory();
        c = f.getComputerType();
        c.ComputerType();
    }
}

interface Factory{
    Computer getComputerType();
}

class DellFactory implements Factory{

    @Override
    public Computer getComputerType() {
        return new Dell();
    }
}

class AcerFactory implements Factory{

    @Override
    public Computer getComputerType() {
        return new Acer();
    }
}

class LenovoFactory implements Factory{

    @Override
    public Computer getComputerType() {
        return new Lenovo();
    }
}

interface Computer{
    public void ComputerType();
}

class Dell implements Computer{

    @Override
    public void ComputerType() {
        System.out.println("Dell Computer");

    }

}

class Acer implements Computer{

    @Override
    public void ComputerType() {
        System.out.println("Acer Computer");

    }

}

class Lenovo implements Computer{

    @Override
    public void ComputerType() {
        System.out.println("Lenovo Computer");

    }

}
